import Vue from 'vue'
const responseCode = [404, 400, 500]
const editorTools = ['bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', 'fontName', 'fontSize', 'foreColor', 'backColor',
  'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull', 'insertUnorderedList', 'insertOrderedList', 'indent', 'outdent', 'createLink', 'unlink', 'insertImage', 'insertFile',
  'tableWizard', 'createTable', 'addColumnLeft', 'addColumnRight', 'addRowAbove', 'addRowBelow', 'deleteRow', 'deleteColumn', 'formatting', 'cleanFormatting', 'insertHtml', 'viewHtml',
  'print', 'copyFormat', 'applyFormat']
export default {
  install() {
    Vue.prototype.responseCode = responseCode
    Vue.prototype.editorTools = editorTools
    // 防重复点击(指令实现)
    Vue.directive('repeatClick', {
      inserted(el, binding) {
        el.addEventListener('click', () => {
          if (!el.disabled) {
            el.disabled = true
            setTimeout(() => {
              el.disabled = false
            }, binding.value || 1000)
          }
        })
      }
    })
  }
}
